#include <stdio.h>
#include <stdlib.h>

struct Complex {
  char ch;
  int a;
  // int b;
  int *ptr;
};

int main() {
  struct Complex s = {10, 20}; // stack mem
  s.a = 30;
  // struct Complex *ps = &s;
  // ps->b = 40;
  // printf("%d %d \n", s.a, s.b);
  int *ptr = (int *) malloc(sizeof(int));
  *ptr = 50;
  printf("%d\n", *ptr);
  struct Complex *stp = (struct Complex *) malloc(sizeof(struct Complex)); // heap mem
  // stp->b = 200;
  stp->ch = 'a';
  stp->a = 100;
  stp->ptr = &(stp->a);
  printf("%c %d %d \n", stp->ch, stp->a, *stp->ptr);
  printf("%p %p %p %p \n", &stp->ch, &stp->a, &stp->ptr, stp->ptr);
}